package com.group.three.service.impl;


import com.group.three.entity.LiMember;
import com.group.three.entity.dto.UserPwdLoginInfoDto;
import com.group.three.mapper.LiMemberMapper;
import com.group.three.service.ILiMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 会员用户表 服务实现类
 * </p>
 *
 * @author XYueong
 * @since 2023-01-12
 */
@Service
public class LiMemberServiceImpl  implements ILiMemberService{

    @Autowired(required = false)
    private LiMemberMapper liMemberMapper;

    @Override
    public UserPwdLoginInfoDto pwdLoginInfoDto(String username,String password) {
        LiMember allUserInfo = liMemberMapper.selectAllUserInfo(username);

        //密码不匹配的情况下会返回null
        if (!allUserInfo.getPassword().equals(password)){
            return null;
        }


        //将数据读取到登录信息dto中
        UserPwdLoginInfoDto loginInfoDto =new UserPwdLoginInfoDto();
        loginInfoDto.setId(allUserInfo.getId());
        loginInfoDto.setUsername(allUserInfo.getUsername());
        loginInfoDto.setNickName(allUserInfo.getNickName());
        loginInfoDto.setFace(allUserInfo.getFace());

        return loginInfoDto;
    }
}
